package com.eduadmin.service;

import com.eduadmin.entity.Course;
import com.eduadmin.mapper.CourseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseServiceImpl implements ICourseService {
    private final CourseMapper courseMapper;

    @Autowired
    public CourseServiceImpl(CourseMapper courseMapper) {
        this.courseMapper = courseMapper;
    }

    @Override
    public int addCourses(List<Course> courses) {
        return courseMapper.insertCourses(courses);
    }

    @Override
    public Course getCourseByCourseName(String courseChName) {
        return courseMapper.selectCourseByName(courseChName);
    }

    @Override
    public List<Course> getCourses() {
        return courseMapper.selectCourses();
    }

    @Override
    public Course getCourseByCourseEnName(String courseEnName){ return courseMapper.getCourseByCourseEnName(courseEnName);}

}
